<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"
	import="javax.ejb.*,javax.naming.*,com.tiger.cmpeb.sample3.*"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>検索結果</title>
</head>
<body>

<%
	//request.setCharacterEncoding("JISAutoDetect");
	
	InitialContext ctx = new InitialContext();
	//"java:comp/env/ejb/CustomerBean03" → "comp/env/ejb/CustomerBean03"
	CustomerHome03 customerHome = (CustomerHome03) ctx.lookup("comp/env/ejb/CustomerBean03");
	//"java:comp/env/ejb/AddressBean02" → "comp/env/ejb/CustomerBAddressBean02ean03"
	AddressHome02 addressHome = (AddressHome02) ctx.lookup("comp/env/ejb/AddressBean02");
	
	Integer customerID = new Integer(request.getParameter("customerID"));
	Customer03 customer = customerHome.findByPrimaryKey(customerID);
	
%>

<table>
	<tr>
		<td>顧客ID</td>
		<td><%=customer.getCustomerID() %></td>
	</tr>
	<tr>
		<td>顧客名</td>
		<td><%=customer.getName() %></td>
	</tr>
	<tr>
		<td>アドレスID</td>
		<td><%=customer.getAddress().getAddressID() %></td>
	</tr>
	<tr>
		<td>国名</td>
		<td><%=customer.getAddress().getCountry() %></td>
	</tr>
	<tr>
		<td>都道府県</td>
		<td><%=customer.getAddress().getPrefecture() %></td>
	</tr>
	<tr>
		<td>市町村</td>
		<td><%=customer.getAddress().getCity() %></td>
	</tr>
	<tr>
		<td>郵便番号</td>
		<td><%=customer.getAddress().getZipCode() %></td>
	</tr>
</table>
<p><a href="index.html">戻る</a></p>
</body>
</html>